<!-- templates/search_results.html -->
{% extends "base.html" %}

{% block title %}搜索结果 - 湖南数学网{% endblock %}

{% block content %}
    <h2 class="my-4">搜索结果: "{{ query }}"</h2>
    {% if results %}
        <div class="table-responsive">
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>书名</th>
                        <th>作者</th>
                        <th>描述</th>
                        <th>ISBN</th>
                        <th>出版日期</th>
                        <th>类别</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    {% for book in results %}
                    <tr>
                        <td>{{ book.title }}</td>
                        <td>{{ book.author }}</td>
                        <td>{{ book.description }}</td>
                        <td>{{ book.isbn }}</td>
                        <td>{{ book.publication_date.strftime('%Y-%m-%d') if book.publication_date else '' }}</td>
                        <td>{{ book.category }}</td>
                        <td>
                            <a href="{{ url_for('book.update_book', book_id=book.id) }}" class="btn btn-secondary me-2">编辑</a>
                            <a href="{{ url_for('book.delete_book', book_id=book.id) }}" class="btn btn-danger">删除</a>
                        </td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
    {% else %}
        <p class="mt-4">没有找到相关结果</p>
    {% endif %}
{% endblock %}
